package com.hcbd.tdwt.ui.fuda.common.vo.weather;

/**
 * - @Description:  紫外线级别
 * - @Author:  LXJ
 * - @Time:  2019/8/6 13:41
 */
public enum UltravioletLevelType {
    Level1(0, 2, "最弱"),
    Level2(3, 5, "弱"),
    Level3(6, 7, "中等"),
    Level4(8, 10, "强"),
    Level5(11, 15, "很强");

    private int minValue;
    private int maxValue;
    private String name;

    UltravioletLevelType(int minValue, int maxValue, String name) {
        this.minValue = minValue;
        this.maxValue = maxValue;
        this.name = name;
    }

    /**
     * 通过值获取枚举类
     *
     * @param c
     * @return
     */
    public static UltravioletLevelType get(int c) {
        for (UltravioletLevelType w : UltravioletLevelType.values()) {
            if (c >= w.minValue && c <= w.getMaxValue()) {
                return w;
            }
        }
        return Level2;
    }

    /**
     * 通过名称获取枚举类
     *
     * @param n
     * @return
     */
    public static UltravioletLevelType get(String n) {
        for (UltravioletLevelType w : UltravioletLevelType.values()) {
            if (w.getName().equals(n)) {
                return w;
            }
        }
        return null;
    }


    public int getMinValue() {
        return minValue;
    }

    public void setMinValue(int minValue) {
        this.minValue = minValue;
    }

    public int getMaxValue() {
        return maxValue;
    }

    public void setMaxValue(int maxValue) {
        this.maxValue = maxValue;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
